<?php
/* creates a link with a tooltip :
    - you can also link to javascript function using the optional 3rd argument;
    - if 'class' is set to $html_options array, will append the classes to the tooltip classes
*/
function vtns_link_to_tooltip($link_text, $tooltip_msg, $function = "", $html_options = array(), $position='top')
{
  $html_options = _parse_attributes($html_options);

  $html_options['href'] = isset($html_options['href']) ? $html_options['href'] : '#';
  $tooltip_class = 'FB_tooltip_link FB_tooltip_'.$position;
  $html_options['class'] = isset($html_options['class']) ? $tooltip_class.' '.$html_options['class'] : $tooltip_class;

  if ( isset($html_options['confirm']) )
  {
    $confirm = escape_javascript($html_options['confirm']);
    unset($html_options['confirm']);
    $function = "if(window.confirm('$confirm')){ $function;}";
  }
  if ($function != "") {
    $html_options['onclick'] = $function.'; return false;';
  }
  
  $tooltip_msg = '<span class="FB_tooltip_new"><span class="tooltip_message">'.__($tooltip_msg).'</span></span>';
  return content_tag('a', $link_text.$tooltip_msg, $html_options);
}